package net.hailxenu.stats;

import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerRespawnEvent;

public class StatsPlayer extends PlayerListener
{
    private XenuStats plugin;
    public StatsPlayer(XenuStats plugin)
    {
        this.plugin = plugin;
    }
    
    @Override
    public void onPlayerLogin(PlayerLoginEvent event)
    {
        plugin.getPlayerData(event.getPlayer()).setStartTime();
        plugin.getPlayerData(event.getPlayer()).qJOIN++;
        plugin.getPlayerData(event.getPlayer()).ONLINE = 1;
    }

    @Override
    public void onPlayerQuit(PlayerEvent event)
    {
        plugin.getPlayerData(event.getPlayer()).setEndTime();
        plugin.getPlayerData(event.getPlayer()).qQUIT++;
        plugin.getPlayerData(event.getPlayer()).ONLINE = 0;
    }

    @Override
    public void onPlayerRespawn(PlayerRespawnEvent event)
    {
        plugin.getPlayerData(event.getPlayer()).qDEATH++;
    }
}
